Imports System.Collections.Generic
Imports System.Data
Imports System.Collections.ObjectModel

Namespace provider
	Public Class SimpleStaticDataProvider
		Implements IAutoCompleteDataProvider
		Private _source As IEnumerable(Of String)

		Public Sub New(source As IEnumerable(Of String))
			_source = source
		End Sub

		Public Function GetItems(textPattern As String) As IEnumerable(Of String) Implements IAutoCompleteDataProvider.GetItems
            Dim temp As New Collection(Of String)
            If textPattern Is Nothing Then
                Return _source
            End If
            For Each item As String In _source
                If item.StartsWith(textPattern, StringComparison.OrdinalIgnoreCase) Then
                    temp.Add(item)
                End If
            Next
            Return temp
		End Function
	End Class
End Namespace
